import http from '@/utils/request.js';
// 救援
// 获取救援工单详情
export const rescueDetail = (data) => {
	// return http.get('/repair/maintain/malfunction/rescue/detail', data);
	return http.request({
		url: '/repair/maintain/malfunction/rescue/detail',
		method: 'get',
		data
	});
};

// 获取救援工单map信息
export const rescueDetailMap = (data) => {
	// return http.get('/repair/maintain/malfunction/rescue/mapUserDetail', data);
	return http.request({
		url: '/repair/maintain/malfunction/rescue/mapUserDetail',
		method: 'get',
		data
	});
};

// 更改工单状态为已到达
export const rescueArrive = (data) => {
	// return http.post('/repair/maintain/malfunction/rescue/arrive', data, true);
	return http.request({
		url: '/repair/maintain/malfunction/rescue/arrive',
		method: 'post',
		data,
		textJson: true,
	});
};

// 救援完成
// 更改电梯状态
export const rescueFinish = (data) => {
	// return http.post('/repair/maintain/malfunction/rescue/finish', data, true);
	return http.request({
		url: '/repair/maintain/malfunction/rescue/finish',
		method: 'post',
		data,
		textJson: true,
	});
};

// 获取字典树
export const dictionaryTree = (data) => {
	// return http.get('/blade-system/dict/dictionary-tree', data);
	return http.request({
		url: '/blade-system/dict/dictionary-tree',
		method: 'get',
		data
	});
};

// 获取电梯位置下拉数据
export const selectList = (data) => {
	// return http.get('/repair/maintain/elevator/listElevator', data);
	return http.request({
		url: '/repair/maintain/elevator/listElevator',
		method: 'get',
		data
	});
};
// 获取电梯视频通话详情
export const getEleInfo = (data) => {
	// return http.get('/tlw/video/v2/devices/videoCall/detail/' + data.id, data);
	return http.request({
		url: '/tlw/video/v2/devices/videoCall/detail/' + data.id,
		method: 'get',
		data
	});
};

// 获取电梯详情
export const elevtorDetail = (data) => {
	// return http.get('/repair/maintain/elevator/detail', data);
	return http.request({
		url: '/repair/maintain/elevator/detail',
		method: 'get',
		data
	});
};
// 获取电梯责任人
export const elevtorMantles = (data) => {
	// return http.get('/repair/elevator/principal/user/detailByElevatorId', data);
	return http.request({
		url: '/repair/elevator/principal/user/detailByElevatorId',
		method: 'get',
		data
	});
};
// 获取电梯品牌
export const getBrand = (data) => {
	// return http.get('/repair/maintain/elevator/list/brand', data);
	return http.request({
		url: '/repair/maintain/elevator/list/brand',
		method: 'get',
		data
	});
};
// 修改电梯信息
export const update = (id, data) => {
	// return http.put(`/repair/maintain/elevator/${id}`, data);
	return http.request({
		url: `/repair/maintain/elevator/${id}`,
		method: 'put',
		data,
		textJson: true
	});
};
export const getDriveMode = () => {
	// return http.get('/elevator/driver/mode');
	return http.request({
		url: '/elevator/driver/mode',
		method: 'get',
	});
};
// 获取电梯状态
export const getElevatorState = (data) => {
	// return http.get('/repair/maintain/elevator/detail/v2', data);
	return http.request({
		url: '/repair/maintain/elevator/detail/v2',
		method: 'get',
		data
	});
};
// 更改电梯状态
export const changeElevatorState = (data) => {
	// return http.post('/repair/maintain/elevator/update', data, true);
	return http.request({
		url: '/repair/maintain/elevator/update',
		method: 'post',
		data,
		textJson: true,
	});
};
// 插入电梯停梯状态日志
export const changeElevatorStoplog = (data) => {
	// return http.post('/repair/elevatorstoplog/save', data, true);
	return http.request({
		url: '/repair/elevatorstoplog/save',
		method: 'post',
		data,
		textJson: true,
	});
};

// 查询电梯历史任务保养
export const maintenanceHistoryTasks = (data) => {
	// return http.post('/repairCheck/elevator/plan/history/finish/by', data, true);
	return http.request({
		url: '/repairCheck/elevator/plan/history/finish/by',
		method: 'post',
		data,
		textJson: true,
	});
};
// 保养任务安排-保养
export const maintenanceUnfinished = (data) => {
	// return http.post('/repairCheck/elevator/plan/history/unfinished/by', data, true);
	return http.request({
		url: '/repairCheck/elevator/plan/history/unfinished/by',
		method: 'post',
		data,
		textJson: true,
	});
};

// 查询电梯历史任务维修
export const repairHistoryTasks = (data) => {
	// return http.post('/repairCheck/elevator/plan/history/finish/wx', data, true);
	return http.request({
		url: '/repairCheck/elevator/plan/history/finish/wx',
		method: 'post',
		data,
		textJson: true,
	});
};

// 查询电梯历史救援列表
export const getElevatorOfRescueInfo = (data) => {
	// return http.get('/repair/maintain/malfunction/rescue/getElevatorOfRescueInfo', data, true);
	return http.request({
		url: '/repair/maintain/malfunction/rescue/getElevatorOfRescueInfo',
		method: 'get',
		data,
		toast: true
	});
};

// 查询电梯任务安排-维修
export const repairUnfinished = (data) => {
	// return http.post('/repairCheck/elevator/plan/history/unfinished/wx', data, true);
	return http.request({
		url: '/repairCheck/elevator/plan/history/unfinished/wx',
		method: 'post',
		data,
		textJson: true,
	});
};

// 查询电梯历史任务-配件
export const partHistoryTasks = (data) => {
	// return http.post('/repairCheck/elevator/plan/history/finish/pj', data, true);
	return http.request({
		url: '/repairCheck/elevator/plan/history/finish/pj',
		method: 'post',
		data,
		textJson: true,
	});
};

// 查询电梯任务安排-配件
export const partUnfinished = (data) => {
	// return http.post('/repairCheck/elevator/plan/history/unfinished/pj', data, true);
	return http.request({
		url: '/repairCheck/elevator/plan/history/unfinished/pj',
		method: 'post',
		data,
		textJson: true,
	});
};

// 维保历史全部

export const getAllPlanList = (data) => {
	// return http.get('/elevator/files/plan/list', data);
	return http.request({
		url: '/elevator/files/plan/list',
		method: 'get',
		data,
	});
};

// 零部件全部历史
export const getAllPlanItem = (data) => {
	// return http.get('/elevator/files/plan/work/item/all', data);
	return http.request({
		url: '/elevator/files/plan/work/item/all',
		method: 'get',
		data,
	});
};
// 零部件保养
export const getAllPlanBy = (data) => {
	// return http.get('/elevator/files/plan/work/item/by', data);
	return http.request({
		url: '/elevator/files/plan/work/item/by',
		method: 'get',
		data,
	});
};
// 零部件维修
export const getAllPlanWx = (data) => {
	// return http.get('/elevator/files/plan/work/item/wx', data);
	return http.request({
		url: '/elevator/files/plan/work/item/wx',
		method: 'get',
		data,
	});
};
// 零部件配件

export const getAllPlanPj = (data) => {
	// return http.get('/elevator/files/plan/work/item/pj', data);
	return http.request({
		url: '/elevator/files/plan/work/item/pj',
		method: 'get',
		data,
	});
};
// 获取电梯详情 健康数据
export const getElevatorHealthInfo = (data) => {
	// return http.get('/repair/maintain/elevator/getElevatorHealthInfo', data, true);
	return http.request({
		url: '/repair/maintain/elevator/getElevatorHealthInfo',
		method: 'get',
		data,
		toast: true
	});
};

// ***************新版电梯详情页面***************

// 部件基础信息
export const getElevatorFoundation = (data) => {
	// return http.get('/repair/maintain/elevator/newDetail', data, true);
	return http.request({
		url: '/repair/maintain/elevator/newDetail',
		method: 'get',
		data,
		toast: true
	});
};

// 获取电梯详情 配件树
export const getTree = (data) => {
	// return http.get('/repair/parts/tree', data, true);
	return http.request({
		url: '/repair/parts/tree',
		method: 'get',
		data,
		toast: true
	});
};

// 根据电梯ID 获取新配件树
export const getTreeNew = (data) => {
	// return http.get('/repair/parts/getElevatorStructureTree', data, true);
	return http.request({
		url: '/repair/parts/getElevatorStructureTree',
		method: 'get',
		data,
		toast: true
	});
};

// 获取最新结构 配件树的层站结构 树
export const getTemplateTree = (data) => {
	// return http.get('/repair/elevator/floor/stand/template/getTree', data, true);
	return http.request({
		url: '/repair/elevator/floor/stand/template/getTree',
		method: 'get',
		data,
		toast: true
	});
};

// 获取最新结构 配件树的层站结构 列表
export const getTemplateTreeList = (data) => {
	// return http.get('/repair/elevator/floor/stand/template/getList', data, true);
	return http.request({
		url: '/repair/elevator/floor/stand/template/getList',
		method: 'get',
		data,
		toast: true
	});
};

// 获取整梯隐患
export const getPitfallList = (data) => {
	// return http.get('/repair/maintain/elevator/plan/list/byAndWx', data, true);
	return http.request({
		url: '/repair/maintain/elevator/plan/list/byAndWx',
		method: 'get',
		data,
		toast: true
	});
};

// 获取维保服务电话列表
export const getElevatorPhones = () => {
	// return http.get('/repair/maintain/elevator/getElevatorPhones');
	return http.request({
		url: '/repair/maintain/elevator/getElevatorPhones',
		method: 'get',
	});
};

// 获取型号列表
export const getBrandversionList = (data) => {
	// return http.get('/repair/brandversion/list', data);
	return http.request({
		url: '/repair/brandversion/list',
		method: 'get',
		data,
	});
};

// 获取系列列表
export const getBrandversionskuList = (data) => {
	// return http.get('/repair/brandversionsku/list', data);
	return http.request({
		url: '/repair/brandversionsku/list',
		method: 'get',
		data,
	});
};

// 获取设备品种
export const getDriveModeSelect = (data) => {
	// return http.get('/repair/maintain/elevator/getDriveModeSelect', data);
	return http.request({
		url: '/repair/maintain/elevator/getDriveModeSelect',
		method: 'get',
		data,
	});
};
// 获取控制方式
export const getFieldSelect = (data) => {
	// return http.get('/repair/maintain/elevator/driver/mode/field/select', data);
	return http.request({
		url: '/repair/maintain/elevator/driver/mode/field/select',
		method: 'get',
		data,
	});
};

// 获取电梯绑定的模板
export const getStructures = (data) => {
	// return http.get('/repair/elevator/parts/structure/template/relation/detail', data);
	return http.request({
		url: '/repair/elevator/parts/structure/template/relation/detail',
		method: 'get',
		data,
	});
};

// 编辑摸板
export const editStructure = (data) => {
	// return http.post('/repair/elevator/parts/structure/template/relation/customSaveOrEdit', data, true);
	return http.request({
		url: '/repair/elevator/parts/structure/template/relation/customSaveOrEdit',
		method: 'post',
		data,
		textJson: true,
	});
};

// 获取电梯绑定的模板
export const getBindElevators = (data) => {
	// return http.get('/repair/elevator/parts/structure/template/relation/getAllowRelationElevatorList', data);
	return http.request({
		url: '/repair/elevator/parts/structure/template/relation/getAllowRelationElevatorList',
		method: 'get',
		data,
	});
};

// 统计同项目使用相同结构模板的电梯数量
export const getBindElevatorNum = (data) => {
	// return http.get('/repair/elevator/parts/structure/template/relation/getSameStructureCount', data);
	return http.request({
		url: '/repair/elevator/parts/structure/template/relation/getSameStructureCount',
		method: 'get',
		data,
	});
};

// 电梯配件结构模板关联接口

export const relationToStructureTemplate = (data) => {
	// return http.post('/repair/elevator/parts/structure/template/relation/relationToStructureTemplate', data, true);
	return http.request({
		url: '/repair/elevator/parts/structure/template/relation/relationToStructureTemplate',
		method: 'post',
		data,
		textJson: true,
	});
};

// 我的电梯-个人管理电梯-小区项目列表
export const getPersonalBuildingList = (data) => { 
	return http.request({
		url: '/repair/building/rescueBuildingList',
		method: 'get',
		data, 
	});
};

// 懒加载查询部分电梯楼栋
export const  getElevatorReles = (data) => { 
	return http.request({
		url: '/repair/elevator/template/rele/tree',
		method: 'get',
		data, 
	});
};
//
// 获取判断是否有关联的维修单
// data：true-已有关联维修工单，false-未创建关联维修工单
//
export const getRescueRepairOrder = (data) => {
	return http.request({
		url: '/repair/maintain/malfunction/rescue/has/rela/mal/order',
		method: 'get',
		data,
	});
};